<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php find_selected_page(); ?>
<?php include("includes/header.php"); ?>
<table id="structure">
	<tr>
		<td id="navigation">
			<?php echo  navigation($selSubj, $selPage)?>
			<br />
			<a href="new_subject.php"> + Add a new subject</a>
		</td>
		<td id="page">			
			<?php
				if( !is_null($selSubj) )
				{
			?>
				<h2><?php echo $selSubj['menu_name']; ?></h2>
			<?php
				}
				elseif (!is_null($selPage))
				{
			?>				 
				<h2><?php echo $selPage['menu_name']; ?></h2>
				<div class="page-content">
					<?php echo $selPage['content']; ?>
				</div>
			<?php
				}
				else 
				{ 
			?>
				<h2>Select a subject or page to edit</h2>
			<?php } ?>			
		</td>
	</tr>
</table>
<?php require("includes/footer.php"); ?>
